package com.example.friendfindertwo.adapter;

import java.util.ArrayList;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.friendfindertwo.fragment.FriendPageFragment;
import com.example.friendfindertwo.fragment.FriendRequestFragment;
import com.example.friendfindertwo.fragment.SearchFriendFragment;

public class FriendPagerAdapter extends FragmentPagerAdapter{
	
	final int PAGE_COUNT = 3;
	private ArrayList<Fragment> listFragment;

	public FriendPagerAdapter(FragmentManager fm) {
		super(fm);
		// TODO Auto-generated constructor stub
		listFragment = new ArrayList<Fragment>();
		listFragment.add(SearchFriendFragment.create(0));
		listFragment.add(FriendPageFragment.create(1));
		listFragment.add(FriendRequestFragment.create(2));
	}

	@Override
	public Fragment getItem(int position) {
		// TODO Auto-generated method stub
		
		return listFragment.get(position);
//		switch(position){
//		case 0:
//			return SearchFriendFragment.create(position);
//		case 1:
//			return FriendPageFragment.create(position+1);
//		case 2:
//			return FriendRequestFragment.create(position);
//		default:
//			return FriendPageFragment.create(position);
//		}
		//return FriendPageFragment.create(position+1);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return listFragment.size();
	}
	
	@Override
	public CharSequence getPageTitle(int position){
		switch(position){
		case 0:
			return "search";
		case 1:
			return "friends";
		case 2:
			return "requests";
		}
		return "default";
	}

}
